
<h2>Installed modules</h2>

<table class="su_admin_table">
  <tr>
  <th><?php echo TABLE_HEADING_MODULE ; ?></th>
  <th><?php echo TABLE_HEADING_VERSION ; ?></th>
  <th><?php echo TABLE_HEADING_UPDATED ; ?></th>
  <th><?php echo TABLE_HEADING_LICENCE ; ?></th>
  <th><?php echo TABLE_HEADING_AUTHOR ; ?></th>
  <th><?php echo TABLE_HEADING_NOTES ; ?></th>
  </tr>
<?php
$sql = "SELECT * FROM ".TABLE_AUTO_UPDATE." ORDER BY version DESC, module";

$query = $db->execute($sql);


while(!$query->EOF){
// print_r($query->fields);
print '<tr><td>'.$query->fields['module'].'</td><td class="cntr">'.$query->fields['version'].'</td><td>'.(is_null($query->fields['updated']) ? 'Default Installed' : $query->fields['updated'] ).'</td><td>'.$query->fields['licence'].'</td><td>'.$query->fields['authors'].'</td><td>'.$query->fields['notes'].'</td></tr>';
$query->MoveNext();
}
?>
</table>

<h2>Available updates.</h2>

<table class="su_admin_table">
  <tr>
  <th><?php echo TABLE_HEADING_MODULE ; ?></th>
  <th><?php echo TABLE_HEADING_VERSION ; ?></th>
  <th><?php echo TABLE_HEADING_STATUS ; ?></th>
  </tr>
<?php
$sql = "SELECT aua.module, aua.version, aua.status, URL, last_checked FROM `".TABLE_AUTO_UPDATE_AVAILABLE."` aua LEFT JOIN `".TABLE_AUTO_UPDATE."` au ON aua.module=au.module WHERE status !='F' ";

$query = $db->execute($sql);
$error_recovery = array();

while(!$query->EOF){
// print_r($query->fields);
  print '<tr><td>'.$query->fields['module'].'</td><td class="cntr">'.$query->fields['version'].'</td><td>'.( ($query->fields['status']=='E') ? 'Error, see error log below' : (($conf['autodownload']==1) ? 'Download scheduled:'.date('H:i:s d-M-Y', $query->fields['last_checked']) : 'Auto download disabled<br /> Update location: <a href="'. $query->fields['URL'] .'">'.$query->fields['URL'].'</a>')).'</td></tr>';

  if($query->fields['status']=='E'){
    $error_recovery[] = 'Clear <a href="'.zen_href_link(FILENAME_AUTO_UPDATE, 'm='.urlencode($query->fields['module']) ).'">auto update for '.$query->fields['module'].'</a>';
  }

$query->MoveNext();
}

?>
</table>

